<?php
namespace jy_newnong;
defined('BY_JYA') or exit('error');
/*
*/
class notice extends \plugin{
	public function payorder($order=array()){
		$title=pdo_getcolumn('jy_farmer_guoshu',array('uniacid'=>$_SESSION['uniacid'],'id'=>$order['guoshu_id']),'title');
		$template_id=cfc('account')->get_tpl_template_id('42983','订单已确认通知','',array('订单编号','商品名称','商品数量','订单金额'));
        $message=array(
            'first'=>array('value'=>'订单已确认通知，点击立即查看！',"color" => "#4a5077"),
            'character_string'=>array('value'=>$order['ordersn'],"color" => "#4a5077"),
            'thing3'=>array('value'=>$title,"color" => "#4a5077"),
            'number4'=>array('value'=>$order['total'],"color" => "#4a5077"),
			'amount8'=>array('value'=>$order['money'],"color" => "#4a5077"),
            'remark'=>array('value'=>'如有任何疑问，请直接回复公众号，我们客服将第一时间为您服务！',"color" => "#4a5077"),
        );
		$basic=$this->plugin_setting('basic');
		if($basic['is_urlwxapp'] && $basic['urlappid']){
			$url=array(
				'appid'=>$basic['urlappid'],
				'pagepath'=>'jy_newnong/myguoshu/index',
			);
		}else{
			$url=custom_url('jy_newnong/myguoshu/',true);
		}
		cfc('account')->sendtwoNotice($order['mid'],$template_id,$message,$url,'payorder','jy_newnong',$order['id']);	
		return false;
	}
	public function upguoshuimg($log_id=0){
		$log=pdo_get('jy_farmer_gdopt',array('id'=>$log_id,'uniacid'=>$_SESSION['uniacid']));
		$log['imgs']=$log['imgs']?json_decode($log['imgs'],true):array();
		$title=pdo_getcolumn('jy_farmer_guoshu',array('uniacid'=>$_SESSION['uniacid'],'id'=>$log['guoshu_id']),'title');
		$username=pdo_getcolumn('jy_farmer_order',array('id'=>$log['order_id'],'uniacid'=>$_SESSION['uniacid']),'username');
		$worker=pdo_get('jy_farmer_worker',array('mid'=>$_SESSION['uid'],'uniacid'=>$_SESSION['uniacid']));
		$template_id=cfc('account')->get_tpl_template_id('43711','工单处理通知','',array('项目名称','任务名','上报人','上报原因'));
        $message=array(
            'first'=>array('value'=>'工单处理通知，点击立即查看！',"color" => "#4a5077"),
            'thing31'=>array('value'=>$title,"color" => "#4a5077"),
            'thing21'=>array('value'=>'【给果树上传了照片】',"color" => "#4a5077"),
            'thing25'=>array('value'=>$worker['name'],"color" => "#4a5077"),
			'thing27'=>array('value'=>'按时完成果树照片上传！',"color" => "#4a5077"),
            'remark'=>array('value'=>'如有任何疑问，请直接回复公众号，我们客服将第一时间为您服务！',"color" => "#4a5077"),
        );
		$basic=$this->plugin_setting('basic');
		if($basic['is_urlwxapp'] && $basic['urlappid']){
			$url=array(
				'appid'=>$basic['urlappid'],
				'pagepath'=>'jy_newnong/myguoshu/index',
			);
		}else{
			$url=custom_url('jy_newnong/myguoshu/',true);
		}
		cfc('account')->sendtwoNotice($log['mid'],$template_id,$message,$url,'upimg','jy_newnong',$log['id']);	
		return false;
	}
}